package com.kaibes.admin.monitior;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import com.kaibes.core.base.util.UnitUtils;
import com.kaibes.module.monitior.MonitorService;
import com.kaibes.web.admin.AdminController;
import com.kaibes.web.api.ApiLink;

@AdminController
@RequestMapping("/admin/monitor")
public class MonitorController {

    @Autowired
    private MonitorService monitorService;

    @ApiLink("服务器状态")
    @GetMapping("server")
    public String server(Model model) {
        model.addAttribute("UnitUtils", UnitUtils.class);
        model.addAttribute("app", monitorService.getAppDO());
        model.addAttribute("system", monitorService.getSystemDO());
        model.addAttribute("cpu", monitorService.getCpuDO());
        model.addAttribute("memory", monitorService.getMemoryDO());
        model.addAttribute("disk", monitorService.getDiskDO());
        model.addAttribute("jvm", monitorService.getJvmDO());
        return "monitor-server";
    }

}
